package gnss

type YObsSignal struct {
	NaviSys byte
	SatId   byte // 可能会超过255, rangecmp中定义ushort
	SigId   byte
	SigCode string

	PsV     float64
	PhV     float64 // 相位 周数
	Doppler float64
	Cnr     float32
	LkT     int64 // ms
	LLI     byte  // 失锁
	HalfAmb byte
}

func (this *YObsSignal) Reset() {
	this.SigCode = ""
	this.PsV = 0
	this.PhV = 0
	this.Doppler = 0
	this.Cnr = 0
	this.SatId = 0
	this.SigId = 0
	this.LLI = 0
}

func (this *YObsSignal) IsValid() bool {
	return this.PsV != 0 && this.PhV != 0
}

func (this *YObsSignal) GetSignalCode() string {
	if len(this.SigCode) > 0 {
		return this.SigCode
	}

	str := YObsSigID2Code(this.NaviSys, this.SigId)
	if str == "NN" {
		return ""
	}
	this.SigCode = str
	return this.SigCode
}

func (this *YObsSignal) GetPrnCode() string {
	return GetPrnStrCode(byte(this.SatId), this.NaviSys)
}

func (this *YObsSignal) GetSignType() byte {
	return YObsSigId2SigType(this.NaviSys, this.SigId)
}
